package com.yanqu.road.server.cmd.monopolymarket.fortress;

import com.yanqu.road.pb.monopolymarket.MonopolyMarketProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.monopolymarket.MonopolyMarketFortressMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @Description
 * @Author cwq
 * @Data 2021/10/15 16:32
 */
@Cmd(code = CrossProtocol.C_MONOPOLY_MARKET_FORTRESS_RANK_RECEIVE_REWARD, desc = "边关要塞 领奖")
public class CrossMonopolyMarketFortressReceiveRankRewardCmd extends CrossCommand {

    private long userId ;
    private int cityId;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        MonopolyMarketProto.MonopolyMarketFortressRankReceiveRewardReqMsg req = MonopolyMarketProto.MonopolyMarketFortressRankReceiveRewardReqMsg.parseFrom(packet.getBytes());
        userId = packet.getPlayerId();
        cityId = req.getId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId , YanQuMessageUtils.buildMessage(GameProtocol.S_MONOPOLY_MARKET_FORTRESS_RECEIVE_RANK_REWARD_FROM_CROSS, MonopolyMarketFortressMgr.receiveRankReward(serverId,userId,cityId)));
    }

    @Override
    public void sendData() {

    }
}
